package com.lmf.annotation.config;

import com.lmf.annotation.bean.Car;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * 验证 bean生命周期 使用的配置类
 */
@ComponentScan("com.lmf.annotation.bean")
@Configuration
public class MyConfigOfLifeCycle {

    @Scope("prototype")
    //类自定义管理生命周期，方式一： 使用的初始化，销毁方法
    @Bean(initMethod = "init",destroyMethod = "destroy")
    public Car car(){
        return new Car();
    }
}
